//Sat Jul  2 16:43:23 CDT 2011
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

class GameOfLifeDivTwo {
public:
	string theSimulation(string, int);
};

string GameOfLifeDivTwo::theSimulation(string init, int T) {
	int N = init.size();
	for(int i=0; i<T; i++){
		string tmp = "";
		for(int j=0; j<N; j++){
			int p = (j-1+N)%N;
			int q = (j+1)%N;
			int sum = (init[p]-'0')+(init[q]-'0')+(init[j]-'0');
			if(sum >=2)
				tmp+="1";
			else
				tmp +="0";
		}
		init = tmp;
	}
	return init;
}


//Powered by [KawigiEdit] 2.0!
